import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)
// 获取原型对象上的push函数
const originalPush = Router.prototype.push
// 修改原型对象中的push方法
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
const routes = new Router({
  routes: [
    // 首页
    {
      path: '/',
      name: 'Index',
      component: resolve => {
        require(['../views/Index'], resolve)
      }
    },
    // 设置
    {
      path: '/setting',
      name: 'Setting',
      component: resolve => {
        require(['../views/user/Setting'], resolve)
      }
    },
    // 探索
    {
      path: '/explore',
      name: 'Explore',
      component: resolve => {
        require(['../views/Explore'], resolve)
      }
    },
    // 转移
    {
      path: '/transfer',
      name: 'Transfer',
      component: resolve => {
        require(['../views/works/Transfer'], resolve)
      }
    },
    // 出售
    {
      path: '/sell',
      name: 'Sell',
      component: resolve => {
        require(['../views/sell/Sell'], resolve)
      }
    },
    // 详情
    {
      path: '/details',
      name: 'Details',
      component: resolve => {
        require(['../views/details/Details'], resolve)
      }
    },
    // 搜索
    {
      path: '/search',
      name: 'Search',
      component: resolve => {
        require(['../views/Search'], resolve)
      }
    },
    // 购买
    {
      path: '/buypage',
      name: 'Buypage',
      component: resolve => {
        require(['../views/buypage/Buypage'], resolve)
      }
    },
    // 个人藏品
    {
      path: '/person_collection',
      name: 'PersonCollection',
      component: resolve => {
        require(['../views/user/PersonCollection'], resolve)
      }
    },
    // mint
    {
      path: '/mint_imeet',
      name: 'Mint',
      component: resolve => {
        require(['../views/imeet/Mint'], resolve)
      }
    },
    // 帮助中心
    {
      path: '/help_center',
      name: 'HelpCenter',
      component: resolve => {
        require(['../views/helpCenter/HelpCenter'], resolve)
      }
    },
    // 经纪人展示页
    {
      path: '/brokerdisplay',
      name: 'Brokerdisplay',
      component: resolve => {
        require(['../views/brokerdisplay/BrokerDisplay'], resolve)
      }
    },
    // 合集管理
    {
      path: '/collection',
      name: 'CollectionMenu',
      component: resolve => {
        require(['../views/collection/CollectionMenu'], resolve)
      }
    },
    // 排名
    {
      path: '/ranking',
      name: 'Ranking',
      component: resolve => {
        require(['../views/ranking/Ranking'], resolve)
      }
    },
    // 功能
    {
      path: '/home_function',
      name: 'HomeFunction',
      component: resolve => {
        require(['../views/homefun/HomeFunction'], resolve)
      }
    },
    // 交易
    {
      path: '/transaction',
      name: 'Transaction',
      component: resolve => {
        require(['../views/transaction/Transaction'], resolve)
      }
    },
    // 个人全部作品页
    {
      path: '/personal_Works',
      name: 'PersonalWorks',
      component: resolve => {
        require(['../views/User/PersonalWorks'], resolve)
      }
    },
    // 竞拍
    {
      path: '/bidding',
      name: 'Bidding',
      component: resolve => {
        require(['../views/bidding/Bidding'], resolve)
      }
    },
    // 水印
    {
      path: '/watermark',
      name: 'Watermark',
      component: resolve => {
        require(['../views/watermark/Watermark'], resolve)
      }
    },
    // 上传水印
    {
      path: '/upload_water',
      name: 'watermark',
      component: resolve => {
        require(['../views/watermark/UploadWater'], resolve)
      }
    },
    // 作品集
    {
      path: '/works_set',
      name: 'watermark',
      component: resolve => {
        require(['../views/watermark/worksSet'], resolve)
      }
    }
  ]
})
export default routes
